package com.yu.crm.controller;

import com.alibaba.fastjson.JSONArray;
import com.yu.crm.domain.request.TTicketStatus;
import com.yu.crm.utils.TicketUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ticketStatus")
public class TTicketStatusController {

    /**
     * 接收检票信息数据，并实时推送数据
     * @param tTicketStatus
     * @return
     */
    @ApiOperation(value = "保存")
    @PostMapping(value = "/save")
    public boolean save(@RequestBody TTicketStatus tTicketStatus){
        //实时推送数据
        String urlPath = "http://58.49.165.122:26040/WebSer_kyz/get_kljjjj2109www_T_TICKETINFO.aspx";
//        String urlPath = "http://localhost:8888/data_sync";
//        String param  = "attendanceInfos=" + JSONArray.toJSONString(tTicketStatus);
        String param  = "T_TICKETSTATUS=" + JSONArray.toJSONString(tTicketStatus);
        TicketUtil.push(urlPath ,param);
        return true;
    }
}
